package bookmanagement.operation.impl;

import bookmanagement.book.BookList;
import bookmanagement.operation.IOperation;

// 更新操作
public class UpdateOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("您现在进行的书籍修改操作");
        System.out.println("请输入要修改书籍的名称");
        String booksName = scanner.next();
        if (bookList.findBooks(booksName)) {
            System.out.println("请输入要修改的价格");
            double price = scanner.nextDouble();
            System.out.println("请输入要修改的类别");
            String type = scanner.next();
            bookList.updateBooks(booksName,price,type);
            System.out.println("修改书籍成功!");
        }else {
            System.err.println("您要修改的书籍不存在，请查证后再试");
        }
    }
}
